package com.yaner.controller;

import com.yaner.domain.User;
import com.yaner.service.impl.UserServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
public class UserController {

    private final UserServiceImpl userServiceImpl;
    public UserController(UserServiceImpl userServiceImpl) {
        this.userServiceImpl = userServiceImpl;
    }

    @GetMapping("/select")
    public List<User> selectList() {
        List<User> userList = userServiceImpl.selectMaster();
        log.info("master userList:{}",userList);
        List<User> selectSlave = userServiceImpl.selectSlave();
        log.info("slave selectSlave:{}",selectSlave);
        userList.addAll(selectSlave);
        return userList;
    }
}
